package aex.service;



import java.io.Serializable;
import java.util.LinkedHashMap;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import aex.dao.CommentMedicinesDao;
import aex.domain.CommentMedicines;
import aex.util.PageBean;



@Transactional(readOnly = false)
@Service(CommentMedicinesService.SERVICE_NAME)

public class CommentMedicinesService  {

	
	public static final String SERVICE_NAME="aex.service.CommentMedicinesService";
	/**
	 * 以注解的形式让spring为我们注入dao的实现类
	 */
	@Resource(name = CommentMedicinesDao.SERVICE_NAME)
	public CommentMedicinesDao dao;
	
	public CommentMedicinesService() {
		
	}
	public CommentMedicines findByID(Serializable id) {
		return dao.findObjectByID(Integer.parseInt(id+""));
	}
	public void deleteById(Serializable id) {
		dao.deleteObjectByIDs(Integer.parseInt(id+""));
	}
	public void save(CommentMedicines obj) {
		dao.save(obj);
	}
	public void update(CommentMedicines obj) {
		dao.merge(obj);
	}
	public PageBean<CommentMedicines> findByCategory(
			PageBean<CommentMedicines> pageBean, int id) {
		LinkedHashMap<String, String> orderby=new LinkedHashMap<String, String>();
		orderby.put("tName.cmTime", "desc");
		return dao.findPageBean("and tName.medicines="+id, null, orderby, pageBean);
	}
}
